﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using HammerMUD.Commands;
using HammerMUD.NPC;

namespace HammerMUD.Admin
{
    public class EditNpcCommand : Command
    {
        public EditNpcCommand()
        {
            Name = "editnpc";
            Help = "editnpc <npc> name <name>";
            SecurityLevel = SecurityLevel.Admin;
        }

        public override void Do(HammerMUD.System.User from, List<string> arguments)
        {
            if (arguments.Count < 4)
            {
                from.Send(Help);
                return;
            }


            Npc theNpc = null;
            foreach (Npc n in from.UserAccount.CurrentCharacter.CurrentRoom.Npcs)
            {
                if (n.Name.ToLower().Equals(arguments[1].ToLower()))
                {
                    theNpc = n;
                    break;
                }
            }

            if (theNpc == null)
            {
                from.Send("That NPC is not here!");
                return;
            }

            if (arguments[2].Equals("name"))
            {
                theNpc.Name = arguments[3];
                from.Send("Name of the NPC changed to " + arguments[3]);
                return;
            }

            from.Send("Sorry, editnpc is not yet fully implemented!");
        }
    }
}
